<template>
  <div style="position: absolute;top: 50%;left: 50%;-webkit-transform: translate(-50%, -50%);
            -moz-transform: translate(-50%, -50%);
            -ms-transform: translate(-50%, -50%);
            -o-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);">
    <el-form ref="form" :model="shareJson" label-width="80px" style="margin-top: 50px">
    <el-form-item label="文件秘钥">
      <el-input v-model="shareJson.number" style="width: 50%;"></el-input>
    </el-form-item>
    <el-form-item label="提取密码">
      <el-input v-model="shareJson.pwd" style="width: 50%;"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="useShare">使用文件链接</el-button>
      <el-button type="primary" @click="useStoreHouseShare">使用资源库链接</el-button>
      <el-button>取消</el-button>
    </el-form-item>
  </el-form>
  </div>

</template>
<script>
import {baseUrl} from "../api/baseUrl"
import {openWindow} from "../api/utils/window"
import {getStoreHouse} from "../api/modules/share";

export default {
  data () {
    return {
      shareJson: {

      }
    }
  },
  methods: {
    useStoreHouseShare(){
      let json = {
        "number": this.shareJson.number,
        "pwd": this.shareJson.pwd
      }
      let _this = this
      this.$http.share.getStoreHouse(json).then(function (resp) {
        if (resp.code == 2000) {
          openWindow(resp.data, "资源库", 1500, 750)
          _this.$notify({
            title: resp.data.fileName,
            type: "success"
          })
        }
      })
    },
    useShare () {
      let json = {
        "number": this.shareJson.number,
        "pwd": this.shareJson.pwd
      }
      let _this = this
      this.$http.share.getShare(json).then(function (resp) {
        if (resp.code == 2000) {
          openWindow(resp.data.fileUrl, resp.data.fileName, 1500, 750)
          _this.$notify({
            title: resp.data.fileName,
            type: "success"
          })
        }
      })
    }
  }
}
</script>
<style>

</style>
